package de.slothsoft.test.treetable2;

import java.awt.Component;

import javax.swing.DefaultListSelectionModel;
import javax.swing.JScrollPane;

import de.slothsoft.commons.res.CommonImages;
import de.slothsoft.commons.swing.window.AbstractMainFrame;

public class _TreeTableExample extends AbstractMainFrame {

	private static final long serialVersionUID = 1L;

	public static void main(String[] args) {
		_TreeTableExample mainFrame = new _TreeTableExample();
		mainFrame.setVisible(true);
	}

	public _TreeTableExample() {
		setTitle("Meine TreeTable");
		setIconImage(CommonImages.get(CommonImages.STATUS_ERROR).getImage());
	}

	@Override
	protected Component createComponents() {

		JTreeTable treeTable = new JTreeTable();
		treeTable.setModel(new _FileSystemModel());
		treeTable.setDefaultRenderer(Object.class,
				new SlothsoftTreeTableCellRenderer());
		treeTable.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);

		return new JScrollPane(treeTable);
	}
}
